package com.fyzk.adapter;


import android.content.res.Resources;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fyzk.bean.DocumentaryMenuResponse;
import com.tyjc.lottery.R;

/**
 * Created by Administrator on 2018/9/25.
 */

public class DocumentaryMenuAdapter extends BaseQuickAdapter<DocumentaryMenuResponse, BaseViewHolder> {

    private int currentIndex = 0;

    public DocumentaryMenuAdapter() {
        super(R.layout.item_documentary_menu_new);
    }

    @Override
    protected void convert(BaseViewHolder helper, DocumentaryMenuResponse item) {
        helper.setText(R.id.discoverFragUI_followOrder, item.getName());
//        Resources resources = mContext.getResources();
//        int resourcesId = resources.getIdentifier(item.getIcon(), "drawable", mContext.getPackageName());
//        helper.setImageResource(R.id.iv_icon, resourcesId);
        helper.itemView.setSelected(helper.getLayoutPosition() == currentIndex);
    }

    public DocumentaryMenuResponse getCurrentItem() {
        return getItem(currentIndex);
    }

    public int getCurrentIndex() {
        return currentIndex;
    }

    public void setCurrentIndex(int currentIndex) {
        this.currentIndex = currentIndex;
        this.notifyDataSetChanged();
    }
}
